import React from 'react'
import { useLocation } from 'react-router-dom';
import { useSelector } from 'react-redux';
import { Layout } from 'antd'
import styles from './index.module.less'
const { Content } = Layout;

const Iframe = () => {
    const { panes } = useSelector((state) => state.portal);
    let { pathname } = useLocation();

    const getSrc = () => {
        let item = panes.find(pane => pane.path === pathname.replace('/portal/',''))
        console.log(panes,item)
        return item ? item.src : null;
    }
    return <Layout className={styles.container}>
        <Content>
            <iframe
                className={styles.iframe}
                src={getSrc()}
                allowFullScreen={true}
                webkitallowfullscreen="true"
                mozallowfullscreen="true"
                title="iframe"
            >
                请升级浏览器
            </iframe>
        </Content>
    </Layout>
}

export default Iframe